<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'add.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="css/css.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery-1.9.1.min.js"></script>
  </head>
  
  <body>

 <form action="marketing/addMarketing.do" method="post" name="f1">
<input name="clientid" type="hidden" value="${client.id}"/>
 <table width="100%" border="0" cellpadding="0" cellspacing="1" class="ybox04table">
            <tr>
              <td class="ybox04tdl"><span class="red">*</span> 机会名称：</td>
              <td class="ybox04tdr" colspan="7"><input name="name" type="text"  class="black12" id="textfield9"  value="" /></td>
            </tr>
            <tr>
            
              <td  class="ybox04tdl"><span class="red">*</span> 意向项目：</td>
              <td  class="ybox04tdr">
              <select name="project" id="project" onChange="tochange()">
               <option value="">-------请选择--------</option>
               <c:forEach items="${list1}" var="p">
               <option value="${p.id}">-----${p.name}----</option>
               </c:forEach>
               </select>
              </td>
              <td class="ybox04tdl"><span class="red">*</span> 意向楼栋：</td>
              <td class="ybox04tdr">
              
              <select name="complex" id="complex" onChange="tochange1()">
              <option value="">--------请选择-------</option>
               </select>
              
              </td>
              <td class="ybox04tdl"><span class="red">*</span> 意向单元：</td>
              <td class="ybox04tdr">
              <select name="unit" id="unit"  onchange="tochange2()">
              <option value="">--------请选择-------</option>
               </select>
              
              </td>
               <td class="ybox04tdl"><span class="red">*</span>意向房间：</td>
              <td class="ybox04tdr">
               <select name="roomid" id="roomid">
              <option value="">--------请选择-------</option>
               </select>
              
              
              </td>
            </tr>
            <tr>
            
              <td  class="ybox04tdl"><span class="red">*</span> 客户姓名：</td>
              <td  class="ybox04tdr"><input name="clientname" type="text" value="${client.clientidname}" readonly="readonly"/></td>
              <td class="ybox04tdl"><span class="red">*</span> 联系方式：</td>
              <td class="ybox04tdr"><input name="clinetelephone" type="text" value="${client.phone}" readonly="readonly"/></td>
              <td class="ybox04tdl">业务员编号：</td>
               <td class="ybox04tdr"><input name="userid" type="text" value="${receive.userid}" readonly="readonly"></td>
              <td class="ybox04tdl">业务员姓名：</td>
               <td class="ybox04tdr"><input name="username" type="text" value="${username}" readonly="readonly"></td>
              
            </tr>
            
      
            <tr>
            
              <td  class="ybox04tdl"><span class="red">*</span> 意向描述</td>
              <td colspan="7"  class="ybox04tdr"> <textarea name="intention" style="width:300px;height:100px; " class="form-control" id="意向描述" placeholder="" onKeyUp="checkLength(this);"></textarea><br/><br/>
     <span class="wordage">剩余字数：<span id="sy" style="color:Red;">200</span>字</span></div><br/><br/>
    </td>
           
            <tr>
              <td  class="ybox04tdr"  colspan="8"><span class="red"><input type="submit" value="提交"/>
               <input type="button" value="取消" onClick="end()"/>  </td>
            </tr>
          </table>
</form>

  </body>
  
</html>
<script>
function tochange(){
  				 var project=document.f1.project.value;
  				
	$.ajax({
			url : "marketing/toajax2.do",
			type : "post",
			dataType : "text",
			data : {project : project},
			success : function(requestXMLTest) {
			$("#complex").empty();
			  $("#complex").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	
	
	
function tochange1(){
   var complex=document.f1.complex.value;
  				
	$.ajax({
			url : "marketing/toajax3.do",
			type : "post",
			dataType : "text",
			data : {complex : complex},
			success : function(requestXMLTest) {
			
			$("#unit").empty();
			  $("#unit").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}
	
	function tochange2(){
   var unit=document.f1.unit.value;		
	$.ajax({
			url : "marketing/toajax4.do",
			type : "post",
			dataType : "text",
			data : {unit : unit},
			success : function(requestXMLTest) {
			$("#roomid").empty();
			  $("#roomid").append(requestXMLTest);
			},
			error : function() {
				alert("error");
			}
		});

	}	




	
	

	function checkLength(which) {


		var maxChars = 200; //
		if (which.value.length > maxChars) {
			layer.open({
				icon : 2,
				title : '提示框',
				content : '您出入的字数超多限制!',
			});
			// 超过限制的字数了就将 文本框中的内容按规定的字数 截取
			which.value = which.value.substring(0, maxChars);
			return false;
		} else {
			var curr = maxChars - which.value.length; //250 减去 当前输入的
			document.getElementById("sy").innerHTML = curr.toString();
			return true;
		}
	};

	function end() {
		window.location.href = "receive/list.do";
	}
</script>




